#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define vec vector<int>
#define y1 y_____hahahaha_____1

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return x * sgn;}

const int N = 5e4+10;
const int mod = 10007;

int f[N][155],h[N],cnt,K,n,fac[N],S[155][155],tmp[155];
struct edge{int v,nxt;}e[N<<1];
void link(int x,int y){e[++cnt] = (edge){y,h[x]};h[x] = cnt;}

int upd(int x){return x + (x >> 31 & mod);}

void dfs(int x,int p){
	f[x][0] = 1;
	for(int i = h[x],y;i;i = e[i].nxt)
		if((y = e[i].v) != p){
			dfs(y,x); for(int j = 1;j <= K;j++) f[x][j] = upd(f[x][j] + f[y][j] - mod),f[x][j] = upd(f[x][j] + f[y][j - 1] - mod);
			f[x][0] = upd(f[x][0] + f[y][0] - mod);
		}
}

void dfs1(int x,int p){
	for(int i = h[x],y;i;i = e[i].nxt)
		if((y = e[i].v) != p){
			for(int j = 1;j <= K;j++) tmp[j] = upd(f[x][j] - f[y][j]),tmp[j] = upd(tmp[j] - f[y][j-1]);
			tmp[0] = upd(f[x][0] - f[y][0]);
			for(int j = 1;j <= K;j++) f[y][j] = upd(f[y][j] + tmp[j] - mod),f[y][j] = upd(f[y][j] + tmp[j - 1] - mod);
			f[y][0] = upd(f[y][0] + tmp[0] - mod);
			dfs1(y,x);
		}
}

ll qp(ll x,int t){ll res = 1;for(;t;t >>= 1,x = x * x % mod) if(t & 1) res = res * x % mod;return res;}

int main(){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;K = in;
	for(int i = 1,u,v;i < n;i++) u = in,v = in,link(u,v),link(v,u);
	for(int i = (fac[0] = 1);i <= K;i++) fac[i] = (ll)fac[i - 1] * i % mod;
	S[0][0] = 1; for(int i = 1;i <= K;i++) for(int j = 1;j <= i;j++) S[i][j] = upd((ll)S[i-1][j] * j % mod + S[i - 1][j - 1] - mod);
	dfs(1,0); dfs1(1,0);
	for(int i = 1;i <= n;i++){
		int ans = 0;
		for(int j = 0;j <= K;j++) ans = upd(ans + (ll) S[K][j] * fac[j] % mod * f[i][j] % mod - mod);
		printf("%d\n",ans);
	}
	return 0;
}
